package com.zto.sch.beanfactoryprocessor;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;

/**
 * @program: javatest
 * @description:
 * @author: sch
 * @create: 2020-09-11 23:09
 **/
//@Component
public class MyBeanFactoryProcessor implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
        System.out.println("-------BeanFactoryPostProcessor----------");
        BeanDefinition beanDefinition = beanFactory.getBeanDefinition("userDao");
        beanDefinition.setScope("prototype");

    }
}
